package com.dengqi.mymodule.activity.network.activity;

import android.os.Bundle;
import android.view.View;

import com.dengqi.mymodule.R;
import com.dengqi.mymodule.activity.network.bean.CardBean;
import com.dengqi.mymodule.activity.network.bean.MyCardBean;
import com.dengqi.mymodule.activity.network.bean.ServiceBean;
import com.dengqi.mymodule.activity.network.module.CardContract;
import com.dengqi.mymodule.activity.network.module.CardPresenter;
import com.module.retrofit.utils.ToastUtil;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import java.util.List;

/**
 * @Author: dengqi
 * @CreateDate: 2020/10/19 17:25
 * @Description:
 */
public class CardActivity extends RxAppCompatActivity implements CardContract.CardView, CardContract.MyCardView {

    private String cardType;
    private CardPresenter cardPresenter;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_card);

        cardPresenter = new CardPresenter(this);

    }

    public void onBtn1(View view){
        cardType = "1";
        cardPresenter.getCardList(this);
    }

    public void onBtn2(View view){
        cardType = "2";
        cardPresenter.getCardList(this);
    }

    public void onBtn3(View view){
        cardType = "3";
        cardPresenter.getCardList(this);
    }

    public void onBtn4(View view){
        cardType = "4";
        cardPresenter.getCardList(this);
    }

    public void onBtn5(View view){
        cardType = "5";
        cardPresenter.getCardList(this);
    }

    public void onBtn6(View view){
        cardType = "6";
        cardPresenter.getCardList(this);
    }

    public void onBtn7(View view){
        cardType = "";
        cardPresenter.getMyCardList(this);
    }

    @Override
    public String getUid() {
        return "22";
    }

    @Override
    public String getShopId() {
        return "1";
    }

    @Override
    public String getStatus_() {
        return "2";
    }

    @Override
    public String getCardType() {
        return cardType;
    }

    @Override
    public String getCardStatus() {
        return "1";
    }

    @Override
    public void onMyCardList(List<MyCardBean> result) {
        String messge = "";
        for(MyCardBean myCardBean : result){
            messge = messge + myCardBean.getImgUrl()+"\n";
        }
        ToastUtil.showToast(messge);
    }

    @Override
    public void onCardList(List<CardBean> result) {
        String messge = "";
        for(CardBean cardBean : result){
            messge = messge + cardBean.getImgUrl()+"\n";
        }
        ToastUtil.showToast(messge);
    }

    @Override
    public void onServiceList(List<ServiceBean> result) {
        String messge = "";
        for(ServiceBean serviceBean : result){
            messge = messge + serviceBean.getImgUrl()+"\n";
        }
        ToastUtil.showToast(messge);
    }
}
